<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="user" class="entity.User" scope="session"/>
<jsp:useBean id="users" class="java.util.ArrayList" scope="request"/>

<html>
	<head>
		<title>Recreation Manager -Korisnici</title>
		<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="theme.css" />
		<script type="text/javascript" src="scripts/linkfader.js"></script>
	</head>
	<c:if test="${user.userId==null}">
		<c:redirect url="./main.jsp" />
	</c:if>
	<body>
	<center>
	<c:import url="./header.jsp"></c:import>
	<table class="mainTable">
		<tr>
			<td width="200px" valign="top">
				<c:import url="./menu.jsp"></c:import>
			</td>			
			<td valign="top">
				<table class="list">
					<thead>
						<tr>
							<th colspan="7" align="center"><h2>Lista korisnika</h2></th>
						</tr>
						<tr>
							<th>Slika:</th>
							<th>Ime:</th>
							<th>Prezime:</th>
							<th>E-mail adresa:</th>
							<th>Broj telefona:</th>				
								<c:if test="${user.type=='A'}">
									<th>Izmena podataka:</th>
									<th>Brisanje</th>
								</c:if>
							
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${users}" var="usr">
							<tr>
								<td>
									<c:if test="${usr.avatar==null}">
										<img src="./avatar/default.gif" alt="Default" />
									</c:if>
									<c:if test="${usr.avatar!=null}">
										<img src="./avatar/${usr.avatar}" alt="Slika" />
									</c:if>
								</td>
								<td>${usr.firstName}</td>
								<td>${usr.lastName}</td>
								<td>${usr.email}</td>
								<td>${usr.phone}</td>
								
								
									<c:if test="${user.type=='A'}">
										<td><a href="./PrepareUserEdit?idUsr=${usr.userId}">izmena podataka</a></td>
										<td><a href="./DeleteUser?idUsr=${usr.userId}">brisanje</a></td>
									</c:if>
								
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</td>
		</tr>
	</table>
	</center>
	</body>	
</html>